{% extends 'base.html' %}

{% block title %}
    Список статей
{% endblock %}

{% block body %}
    <div class="row">
        <h1>Статьи:</h1>
    </div>
    <div class="row row-cols-1 row-cols-md-4 g-4">
        {% for article in articles %}
            <div class="col">
                <div class="card h-100">
                    <div class="card-body">
                        <h5 class="card-title">{{ article.title }}</h5>
                        <h6 class="card-subtitle mb-2 text-muted">{{ article.author.user.name }} {{ article.author.user.surname }}</h6>
                        <p class="card-text">{{ article.text | truncate(150) }}</p>
                        <a href="{{ url_for('article.article_detail', article_id=article.id) }}"
                           class="card-link">Read</a>
                    </div>
                    <div class="card-footer">
                        <small class="text-muted">Created at: {{ article.created_at.strftime('%d-%m-%Y %H:%M:%S') }}</small>
                    </div>
                </div>
            </div>
        {% endfor %}
    </div>
{% endblock %}